# Build stage
FROM node:18-alpine as build

WORKDIR /app

# 复制依赖文件
COPY package*.json ./

# 安装依赖
RUN npm install

# 复制源代码
COPY . .

# 构建应用
RUN npm run build

# Production stage
#FROM nginx:alpine

# 复制构建产物到nginx目录
#COPY --from=build /app/dist /usr/share/nginx/html

# 复制nginx配置文件
#COPY nginx.conf /etc/nginx/conf.d/default.conf

# 暴露端口
EXPOSE 5173

# 启动nginx
CMD ["npm", "run", "dev"]
